import request from '@/utils/request'

export function PluginsList(query) {
    return request({
      url: '/kong/plugins/list',
      method: 'get',
      params: query
    })
  }

  export function PluginsByRouteId(id) {
    return request({
      url: '/kong/plugins/route/'+id,
      method: 'get',
    })
  }

  export function PluginsByServiceId(id) {
    return request({
      url: '/kong/plugins/service/'+id,
      method: 'get',
    })
  }
  

export function PluginsByConsumerId(id) {
  return request({
    url: '/kong/consumer/plugins/'+id,
    method: 'get',
  })
}

  export function pluginSchemaByName(name){
    return request({
      url: '/kong/plugins/schema/'+name ,
      method: 'get' ,    
    })
  }


  export function kongPluginAdd(data) {
  return request({
    url: '/kong/plugins/add',
    method: 'post',
    data: data
  })
}

export function kongPluginDelete(id) {
  return request({
    url: '/kong/plugins/delete/'+id,
    method: 'post',
  })
}

export function kongPluginUpdate(data) {
  return request({
    url: '/kong/plugins/update/'+data.id,
    method: 'post',
    data: data
  })
}